{#**
 * 2007-2017 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2017 PrestaShop SA
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *#}
{% extends 'PrestaShopBundle:Admin:layout.html.twig' %}

{% block stylesheets %}
    {{ parent() }}
    <link rel="stylesheet" href="{{ asset('themes/default/css/bundle/module/drop.css') }}" />
    <link rel="stylesheet" href="{{ asset('themes/default/css/bundle/plugins/jquery.pstagger.css') }}" />
{% endblock %}

{% block javascripts %}
    {{ parent() }}
    <script src="{{ asset('themes/default/js/bundle/plugins/jquery.pstagger.js') }}"></script>
    <script src="{{ asset('themes/default/js/bundle/module/loader.js') }}"></script>
    <script src="{{ asset('themes/default/js/bundle/module/module_card.js') }}"></script>
    <script src="{{ asset('themes/default/js/bundle/module/module.js') }}"></script>
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-lg-10 col-lg-offset-1">
            {# Bulk Action confirm modal #}
            {% include 'PrestaShopBundle:Admin/Module/Includes:modal_confirm_bulk_action.html.twig' %}
            {# Addons connect modal with level authorization#}
            {% include 'PrestaShopBundle:Admin/Module/Includes:modal_addons_connect.html.twig' with { 'level' : level, 'errorMessage' : errorMessage } %}
            {# Contains toolbar-nav for module page with level authorization #}
            {% include 'PrestaShopBundle:Admin/Module/Includes:modal_import.html.twig' with { 'level' : level, 'errorMessage' : errorMessage } %}
            {# Contains menu with Selection/Categories/Popular and Tag Search #}
            {% include 'PrestaShopBundle:Admin/Module/Includes:menu_top.html.twig' with { 'topMenuData': topMenuData } %}
            <div class="module-sorting-menu">
                <div class="row">
                    <div class="col-lg-12">
                        {% if level > constant('PrestaShopBundle\\Security\\Voter\\PageVoter::LEVEL_UPDATE') %}
                            <div class="module-sorting module-bulk-actions pull-right">
                                <select class="c-select c-select-sm">
                                  <option value="" disabled selected>{{ 'Bulk Actions'|trans({}, 'Admin.Global') }}</option>
                                  <option value="bulk-uninstall">{{ 'Uninstall'|trans({}, 'Admin.Actions') }}</option>
                                  <option value="bulk-disable">{{ 'Disable'|trans({}, 'Admin.Actions') }}</option>
                                  <option value="bulk-enable">{{ 'Enable'|trans({}, 'Admin.Actions') }}</option>
                                  <option value="bulk-reset">{{ 'Reset'|trans({}, 'Admin.Actions') }}</option>
                                  <option value="bulk-enable-mobile">{{ 'Enable Mobile'|trans({}, 'Admin.Modules.Feature') }}</option>
                                  <option value="bulk-disable-mobile">{{ 'Disable Mobile'|trans({}, 'Admin.Modules.Feature') }}</option>
                                </select>
                            </div>
                        {% endif %}
                        <div class="module-sorting module-sorting-author pull-right">
                            <select class="c-select c-select-sm">
                              <option value="" disabled>- {{ 'Sort by'|trans({}, 'Admin.Actions') }} -</option>
                              <option value="name">{{ 'Name'|trans({}, 'Admin.Global') }}</option>
                              <option value="access-desc" selected>{{ 'Last access'|trans({}, 'Admin.Modules.Feature') }}</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>

            {# Actual Page Content #}
		<div class="module-short-list">
			<span class="module-search-result-wording">{{ '%nbModules% installed modules'|trans({'%nbModules%' : modules.modules|length}, 'Admin.Modules.Feature') }}</span>
                           <span class="help-box" data-toggle="popover"
                                data-title="{{ "Installed modules"|trans({}, 'Admin.Modules.Feature') }}"
                                data-content="{{ "These are all the modules you’ve added to your shop, either by buying it from PrestaShop Addons, or by uploading it directly."|trans({}, 'Admin.Modules.Help') }}">
                           </span>
                   </div>
		{% include 'PrestaShopBundle:Admin/Module/Includes:grid_manage_installed.html.twig' with { 'modules': modules.modules, 'display_type': 'list', 'origin': 'manage', 'id': 'all' } %}

		<hr class="top-menu-separator">

		<div class="module-short-list">
			<span class="module-search-result-wording">{{ '%nbModules% built-in modules'|trans({'%nbModules%' : modules.native_modules|length}, 'Admin.Modules.Feature') }}</span>
                           <span class="help-box" data-toggle="popover"
                                 data-title="{{ "Built-in modules"|trans({}, 'Admin.Modules.Feature') }}"
                                data-content="{{ "These modules from PrestaShop are preinstalled when you set-up your shop. They cover the basics of e-commerce and comes for free."|trans({}, 'Admin.Modules.Help') }}">
                           </span>
		</div>
		{% include 'PrestaShopBundle:Admin/Module/Includes:grid_manage_installed.html.twig' with { 'modules': modules.native_modules, 'display_type': 'list', 'origin': 'manage', 'id': 'native' } %}

		<hr class="top-menu-separator">

		<div class="module-short-list">
			<span class="module-search-result-wording">{{ '%nbModules% theme modules'|trans({'%nbModules%' : modules.theme_bundle|length}, 'Admin.Modules.Feature') }}</span>
                           <span class="help-box" data-toggle="popover"
                                data-title="{{ "Theme modules"|trans({}, 'Admin.Modules.Feature') }}"
                                data-content="{{ "Each theme you install will come with its own set of modules. You’ll find here all the modules related to your active theme."|trans({}, 'Admin.Modules.Help') }}">
                           </span>
		</div>
		{% include 'PrestaShopBundle:Admin/Module/Includes:grid_manage_installed.html.twig' with { 'modules': modules.theme_bundle, 'display_type': 'list', 'origin': 'manage', 'id': 'theme' } %}
        </div>
    </div>
{% endblock %}

{% set js_translatable = {
"Bulk Action - One module minimum": "You need to select at least one module to use the bulk action."|trans({}, 'Admin.Modules.Notification'),
"Bulk Action - Request not found": 'The action "[1]" is not available, impossible to perform your request.'|trans({}, 'Admin.Modules.Notification'),
"Bulk Action - Request not available for module": "The action [1] is not available for module [2]. Skipped."|trans({}, 'Admin.Modules.Notification'),
}|merge(js_translatable) %}
